package com.marchsoft.service.impl;

import com.marchsoft.dao.AccountPassMapper;
import com.marchsoft.domain.AccountPass;
import com.marchsoft.service.IAccountPassService;

import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;

import javax.annotation.Resource;


@Service
public class AccountPassServiceImpl implements IAccountPassService {

    @Resource
    private AccountPassMapper accountPassMapper;

    /**
     * 判断是否登录成功
     * @param accountPass
     * @return
     */
    @Override
    public Boolean isLogin(AccountPass accountPass) {
        Example example=new Example(AccountPass.class);
        Example.Criteria criteria=example.createCriteria();
        criteria.andEqualTo(accountPass);
        if(accountPassMapper.selectCountByExample(example)==1){
            return true;
        }
        return false;
    }

    /**
     * 返回账号的主键
     * @param accountPass
     * @return
     */
    @Override
    public AccountPass queryAccountId(AccountPass accountPass){
        return accountPassMapper.selectOne(accountPass);
    }
}
